﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * ZIP Central Directory Entry Collection Class
 *      Provides a custom collection class for storing ZipCentralDirectoryEntry instances.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;

namespace Adaptive.Foundation.IO.Zip
{
	/// <summary>
/// Provides a custom collection class for storing <see cref="ZipCentralDirectoryEntry"/> instances.
/// </summary>
	public class ZipCentralDirectoryEntryCollection : GenericCollectionBase<ZipCentralDirectoryEntry>
	{
		/*--------------------------------------------------------------------------------
		 * Constructor / Dispose / Destructor Methods
		 *------------------------------------------------------------------------------*/
		#region Constructor / Dispose / Destructor Methods
		/// <summary>
		/// Initializes a new instance of the class.
		/// </summary>
		/// <remarks>
		/// This is the default constructor.
		/// </remarks>
		public ZipCentralDirectoryEntryCollection()
			: base()
		{
		}
		#endregion

		/*--------------------------------------------------------------------------------
		 * Protected Methods
		 *------------------------------------------------------------------------------*/
		#region Protected Methods
		/// <summary>
		/// Gets the reference key for the object being appended to the collection instance.
		/// </summary>
		/// <param name="itemToGetKeyFor">
		/// The object being appended.
		/// </param>
		/// <returns>
		/// The reference key vlaue to use.
		/// </returns>
		protected override string GetKeyForObject(ZipCentralDirectoryEntry itemToGetKeyFor)
		{
			string returnValue = string.Empty;						//Return value.

			if (itemToGetKeyFor != null)
				returnValue = itemToGetKeyFor.FileName;

			return returnValue;
		}
		#endregion
	}
}